<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>其它设置</title>
<link rel="stylesheet" type="text/css" media="screen"
	href="../../global/css/bootstrap.min.css">
<link rel="stylesheet"
	href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen"
	href="../../global/layui/css/layui.css">
<script type="text/javascript" src="../../global/js/libs/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="../../global/js/jq.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../global/layui/layui.js"></script>
<script type="text/javascript" src="../../global/js/my/permission.js"></script>
</head>
<body>

	<ul id="myTab" class="nav nav-tabs">
		<li class="active"><a href="#home" data-toggle="tab">附近零钱使用 </a></li>
		<li><a href="#ios" data-toggle="tab">扫码佣金</a></li>
	</ul>
	<div id="myTabContent" class="tab-content">
		<div class="tab-pane fade in active" id="home">
			<form id="form1" role="form">
				<div class="form-group" >
                <label class="col-md-2 control-label">附近零钱使用比例</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="nearby_pocket" id="nearby_pocket" />%
                </div>
            </div>
				<div class="form-group" >
                <label class="col-md-2 control-label">扫码零钱使用比例</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="share_user_pocket" id="_pocket" />%
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">每日签到</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="sign_everyday_pocket" id="sign_everyday_pocket" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">连续七日签到</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="sign_sevenday_pocket" id="sign_sevenday_pocket" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">分享精选商品</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" readonly name="share_goods_pocket_once" id="share_goods_pocket_once" />
                </div>
                <label class="col-md-2 control-label">封顶</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" readonly name="share_goods_pocket_time" id="share_goods_pocket_time" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">分享附近店铺</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" readonly name="share_shop_pocket_once" id="share_shop_pocket_once" />
                </div>
                <label class="col-md-2 control-label">封顶</label>
                <div class="col-md-4">
                    <input type="text" class="form-control" readonly name="share_shop_pocket_time" id="share_shop_pocket_time" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">商家入驻</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="shop_register_pocket" id="shop_register_pocket" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">开通代理</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="agent_register_pocket" id="agent_register_pocket" />
                </div>
            </div>
				<button id="button1" type="button" class="btn btn-success">编辑</button>
				<button id="button1a" type="button" class="btn btn-success">提交</button>
			</form>
		</div>
		
		
		
		
		
		<div class="tab-pane fade" id="ios">
			<form id="form2" role="form">
				<div class="form-group" >
                <label class="col-md-2 control-label">新用户注册</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="user_register_redpackage" id="user_register_redpackage" />
                </div>
            </div>
				<div class="form-group" >
                <label class="col-md-2 control-label">邀请新人</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="share_user_redpackage" id="share_user_redpackage" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">商家入驻</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="shop_register_redpackage" id="shop_register_redpackage" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">开通代理</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="agent_register_redpackage" id="agent_register_redpackage" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">消费返还</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="back_redpackage" id="back_redpackage" />
                </div>
            </div>
            <button id="button2" type="button" class="btn btn-success">编辑</button>
				<button id="button2a" type="button" class="btn btn-success">提交</button>
			</form>
		</div>
		<div class="tab-pane fade" id="jmeter">
			<form id="form3" role="form">
				<div class="form-group" >
                <label class="col-md-2 control-label">新用户注册</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="user_register_integration" id="user_register_integration" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">商家入驻</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="shop_register_integration" id="shop_register_integration" />
                </div>
            </div>
            <div class="form-group" >
                <label class="col-md-2 control-label">开通代理</label>
                <div class="col-md-10">
                    <input type="text" class="form-control" readonly name="agent_register_integration" id="agent_register_integration" />
                </div>
            </div>
            <button id="button3" type="button" class="btn btn-success">编辑</button>
				<button id="button3a" type="button" class="btn btn-success">提交</button>
			</form>
		</div>
	</div>

</body>


<script type="text/javascript">
	$(function(){
		$("#button1a").hide();
		$("#button2a").hide();
		$("#button3a").hide();
		//数据回显
		$.ajax({
			url:"/selectDictionaries",
			type:"post",
			dataType:"json",
			success:function(data){
				for(var i=0;i<data.length;i++){
					if(data[i].attcode=="user_register_pocket")
						$("#user_register_pocket").val(data[i].attname);
					if(data[i].attcode=="share_user_pocket")
						$("#share_user_pocket").val(data[i].attname);
					if(data[i].attcode=="sign_everyday_pocket")
						$("#sign_everyday_pocket").val(data[i].attname);
					if(data[i].attcode=="sign_sevenday_pocket")
						$("#sign_sevenday_pocket").val(data[i].attname);
					if(data[i].attcode=="share_goods_pocket_once")
						$("#share_goods_pocket_once").val(data[i].attname);
					if(data[i].attcode=="share_goods_pocket_time")
						$("#share_goods_pocket_time").val(data[i].attname);
					if(data[i].attcode=="share_shop_pocket_once")
						$("#share_shop_pocket_once").val(data[i].attname);
					if(data[i].attcode=="share_shop_pocket_time")
						$("#share_shop_pocket_time").val(data[i].attname);
					if(data[i].attcode=="shop_register_pocket")
						$("#shop_register_pocket").val(data[i].attname);
					if(data[i].attcode=="agent_register_pocket")
						$("#agent_register_pocket").val(data[i].attname);
					if(data[i].attcode=="user_register_redpackage")
						$("#user_register_redpackage").val(data[i].attname);
					if(data[i].attcode=="share_user_redpackage")
						$("#share_user_redpackage").val(data[i].attname);
					if(data[i].attcode=="shop_register_redpackage")
						$("#shop_register_redpackage").val(data[i].attname);
					if(data[i].attcode=="agent_register_redpackage")
						$("#agent_register_redpackage").val(data[i].attname);
					if(data[i].attcode=="back_redpackage")
						$("#back_redpackage").val(data[i].attname);
					if(data[i].attcode=="user_register_integration")
						$("#user_register_integration").val(data[i].attname);
					if(data[i].attcode=="shop_register_integration")
						$("#shop_register_integration").val(data[i].attname);
					if(data[i].attcode=="agent_register_integration")
						$("#agent_register_integration").val(data[i].attname);
				}
				
				
			}
		})
		//
		
	})
	
	//编辑点击
	$("#button1").click(function(){
		$("#button1a").show();
		$("#button1").hide();
		$("#form1 input").attr("readonly",false);
	})
	//提交点击
	$("#button1a").click(function(){
		$("#button1").show();
		$("#button1a").hide();
		submit();
		$("#form1 input").attr("readonly",true);
	})
	
	$("#button2").click(function(){
		$("#button2a").show();
		$("#button2").hide();
		$("#form2 input").attr("readonly",false);
	})
	$("#button2a").click(function(){
		$("#button2").show();
		$("#button2a").hide();
		submit();
		$("#form2 input").attr("readonly",true);
	})
	$("#button3").click(function(){
		$("#button3a").show();
		$("#button3").hide();
		$("#form3 input").attr("readonly",false);
	})
	$("#button3a").click(function(){
		$("#button3").show();
		$("#button3a").hide();
		submit();
		$("#form3 input").attr("readonly",true);
	})
	
	//提交
	function submit(){
		//获取表单数据
		var d = {};
		var t = $('#form1').serializeArray();
		var tt = $('#form2').serializeArray();
		var ttt = $('#form3').serializeArray();
        $.each(t, function () {
            d[this.name] = this.value;
        });
        $.each(tt, function () {
            d[this.name] = this.value;
        });
        $.each(ttt, function () {
            d[this.name] = this.value;
        });
		$.ajax({
			url:"/updateCxDic",
			data:JSON.stringify(d),
			type:"post",
			dataType:"json",
			contentType : "application/json; charset=utf-8",
			success:function(data){
				alert(data.message);
			}
		})
	}
</script>
</html>